package com.lyn.solitude.pluginhost.service

import android.app.Service
import android.content.Intent
import android.os.IBinder
import android.util.Log
import com.lyn.solitude.pluginhost.PluginManager
import com.lyn.solitude.pluginhost.binder.PluginHostBinder

/**
 * 插件服务
 * @author longyn 2024/4/20
 * @version 1.0.0
 */
class PluginService : Service() {
    override fun onBind(intent: Intent): IBinder {
        Log.d(TAG, "onBind")
        return PluginHostBinder
    }

    override fun onCreate() {
        super.onCreate()
        PluginHostBinder.initialize(application)
        Log.d(TAG, "onCreate")
    }

    override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int {
        Log.d(TAG, "onStartCommand")
        return super.onStartCommand(intent, flags, startId)
    }

    override fun onDestroy() {
        super.onDestroy()
        Log.d(TAG, "onDestroy")
    }

    companion object {
        private const val TAG = "PluginService"
    }
}
